package com.wyzz.hr.vo;

import java.util.*;

import com.wyzz.hr.util.MyTools;

public class Hours {

	public Hours() {
	}

	public static List getHourList() {
		List list = new ArrayList();
		int limit = 24;
		for (int i = 0; i < limit; i++) {
			Hours h = new Hours();
			h.setHour(i);
			h.setDescription((new StringBuilder()).append(String.valueOf(i))
					.append("\u70B9").toString());
			list.add(h);
		}

		return list;
	}

	public static List getHourList_24() {
		List list = new ArrayList();
		int limit = 24;
		for (int i = 0; i <= limit; i++) {
			Hours h = new Hours();
			h.setHour(i);
			h.setDescription((new StringBuilder()).append(String.valueOf(i))
					.append("\u70B9").toString());
			list.add(h);
		}

		return list;
	}

	public static List getHourandHalfList_24() {
		List list = new ArrayList();
		int limit = 24;
		for (int i = 0; i <= limit; i++) {
			Hours hInt = new Hours();
			hInt.setHourHalf(i);
			hInt.setDescription((new StringBuilder()).append(String.valueOf(i))
					.append(":00").toString());
			list.add(hInt);
			if (i != limit) {
				Hours hHalf = new Hours();
				hHalf.setHourHalf((float) ((double) i + 0.5D));
				hHalf.setDescription((new StringBuilder()).append(
						String.valueOf(i)).append(":30").toString());
				list.add(hHalf);
			}
		}

		return list;
	}

	public static String getAM_PMDescription(Integer type) {
		if (type == null || type.intValue() == 0)
			return "\u4E0A\u5348";
		else
			return "\u4E0B\u5348";
	}

	public static String getAM_PMDescriptionInStartDate(Date startDate) {
		Calendar c = Calendar.getInstance();
		c.setTime(startDate);
		if (c.get(9) == 1)
			return "\u4E0B\u5348";
		else
			return "\u4E0A\u5348";
	}

	public static String getAM_PMDescription(Date startDate) {
		Calendar c = Calendar.getInstance();
		c.setTime(startDate);
		if (c.get(9) == 0)
			return "0";
		else
			return "1";
	}

	public static String getAM_PMDescriptionInEndDate(Date endDate) {
		Calendar c = Calendar.getInstance();
		c.setTime(endDate);
		c.set(12, c.get(12) - 1);
		if (c.get(9) == 1)
			return "\u4E0B\u5348";
		else
			return "\u4E0A\u5348";
	}

	public static double getTotalDay(double totalHours, double hoursPerDay) {
		double temp = totalHours / hoursPerDay;
		temp = MyTools.round(temp, 2);
		return temp;
	}

	public int getHour() {
		return hour;
	}

	public void setHour(int hour) {
		this.hour = hour;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public float getHourHalf() {
		return hourHalf;
	}

	public void setHourHalf(float hourHalf) {
		this.hourHalf = hourHalf;
	}

	private int hour;
	private float hourHalf;
	private String description;
}
